/*
 * The majority of this KeyEventArgs class is created by Diryboy for IVScripting.Net - http://ivscripting.codeplex.com/.
 * Only minor changes made by me & converted to CLI C++ syntax for use here.
 *
 * GhostGum - 2010
 */



#include "KeyEventArgs.h"
using namespace System;
using namespace System::Collections::Generic;
using namespace System::Text;
namespace GTA
{
	namespace Events
	{
		KeyEventArgs::KeyEventArgs(Keys keyData)
		{
			this->keyData = keyData;
		}

		bool KeyEventArgs::Alt::get()
		{
			return ((this->keyData & Keys::Alt) == Keys::Alt);
		}

		bool KeyEventArgs::Control::get()
		{
			return ((this->keyData & Keys::Control) == Keys::Control);
		}

		bool KeyEventArgs::Handled::get()
		{
			return this->handled;
		}

		void KeyEventArgs::Handled::set(bool value)
		{
			this->handled = value;
		}

		Keys KeyEventArgs::KeyCode::get()
		{
			Keys keys = this->keyData & Keys::KeyCode;
			if (!Enum::IsDefined(Keys::typeid, safe_cast<int>(keys)))
			{
				return Keys::None;
			}
			return keys;
		}

		Keys KeyEventArgs::KeyData::get()
		{
			return this->keyData;
		}

		int KeyEventArgs::KeyValue::get()
		{
			return ((safe_cast<int>(this->keyData)) & 65535);
		}

		Keys KeyEventArgs::Modifiers::get()
		{
			return (this->keyData & ~Keys::KeyCode);
		}

		bool KeyEventArgs::Shift::get()
		{
			return ((this->keyData & Keys::Shift) == Keys::Shift);
		}

		bool KeyEventArgs::SuppressKeyPress::get()
		{
			return this->suppressKeyPress;
		}

		void KeyEventArgs::SuppressKeyPress::set(bool value)
		{
			this->suppressKeyPress = value;
			this->handled = value;
		}
	}
}